<{include file="home_header.tpl"}>
<div class="mycontent">
	<div class="myleft">
    	<div class="topic">
    		<a class="headpic" href="#"><img src="<{$user.user_pic}>" width="132"></a>       
            <a class="username" href="#"><{$user.user_name}></a>
            <div class="dbank"><div class="dbank1">
                <div class="dbankuser" style="width:<{$user.width}>%;"></div>
                <span class="userbig"><{$user.disk_used_str}>/<{$user.disk_size_str}></span>
            </div></div>
            <div class="dbank">
            <input type='hidden' id='hid_sign_in' value='<{$user.sign_in}>'>
            <{if $user.sign_in eq 1}>
            <a class="over" href="javascript:void(0)">已签到,明天再来</a>
            <{else}>
            <a href="javascript:void(0)" id='signin'>签到送空间</a>
            <{/if}>
            </div>
    	</div>
        <div id='userclass' class="userclass">
            <ul>
            <li style="border-top:0px solid #ccc;" cid='0'><a href="javascript:void(0)">所有图书</a></li>
            <{section loop=$categorys name="ls" }>
            <li cid='<{$categorys[ls].category_id}>'><a href="javascript:void(0)" ><{$categorys[ls].name}></a></li>
            <{/section}>
            </ul>
        </div>
        <input type='hidden' id='selected_cid' name='selected_cid' value='<{$curr_cid}>'>
        <input type='hidden' id='selected_cname' value='<{$curr_cname}>'>
    </div>
    <div class="mycenter">
    	<div class="classname" id='classname'>所有图书</div>
        <div class="classlist">
        <span class="book">图书名称</span><span class="writer">作者</span><span class="time">时间</span><span class="time" style="padding:0">操作</span>
        </div>
        <ul class="booklist">
        <{section loop=$page->recordlist name="ls"}><li>
            <span class="book">《<{$page->recordlist[ls].book_name}>》</span>
            <span class="writer"><{$page->recordlist[ls].author}></span>
            <span class="time"><{$page->recordlist[ls].ctime|date_format:"%Y-%m-%d"}></span>
            <a href="http://www.5show5.com/book/download.php?id=<{$page->recordlist[ls].fk_book}>">下载</a>
            <a href="/user/editbook?id=<{$page->recordlist[ls].fk_book}>">编辑</a>
            <a href="/user/delbook?id=<{$page->recordlist[ls].fk_book}>" onclick="return confirm('确定要删除?')">删除</a>
            <a href="/book/<{$page->recordlist[ls].fk_book}>.html" style="width:84px;">评论(<{$page->recordlist[ls].comment_times}>)</a>
        </li><{/section}>
        </ul>
        <div class="fanye" style="float:left;margin-left:8px;width:797px;margin-top:10px;padding-top:10px;">           
            <{$page->pagebar}>
        </div>
    </div> 
</div>
<script>
$(function(){
    var currCid = $('#selected_cid').val();
    if( currCid!= 0){
        $('#classname').html($('#selected_cname').val());
    }
    $('#userclass ul li[cid='+currCid+']').attr('class','hover');
    $('#signin').click(function(){
        if($('#hid_sign_in').val()==0){
            $.get('/user/signin',function(gensize){
                if(gensize>0){
                    alert('签到成功，获得'+gensize+'M空间');
                    $('#signin').attr('class','over');
                    $('#signin').text('已签到,明天再来');
                }
            });
        }
    });
    $('#userclass li').click(function(){
        $('#userclass li').attr('class','');
        $(this).attr('class','hover');
        $('#selected_cid').val($(this).attr('cid'));
        currCid = $('#selected_cid').val();
        $('#classname').html($(this).find('a').text());
        $('#selected_cname').val($(this).find('a').text());
        window.location.href='/user/home?cid='+currCid+'&pageno=1';
    });
    $('.fanye a').click(function(){
        var pageno = $(this).attr('pageno');
        var url = '/user/home?cid='+currCid+'&pageno='+pageno;
        window.location.href=url;
    });
});
</script>
<{include file="footer.tpl"}>
